class_name EventStateTransition
extends StateTransition

## 转移目标状态的名称
var target_state_name: String

## 事件名称
var event_name: String

## 状态转移前时调用的函数
var on_transit_func: Callable

## 是否阻塞事件派发
var handled: bool = false


func _init(
		init_name: String,
		init_target_state_name: String,
		init_event_name: String,
		init_on_transit_func: Callable,
		init_handled: bool
) -> void:
	super(init_name)
	target_state_name = init_target_state_name
	event_name = init_event_name
	on_transit_func = init_on_transit_func
	handled = init_handled


func _try_condition() -> bool:
	return true


func _try_transition() -> String:
	return target_state_name


func _on_transit() -> void:
	on_transit_func.call()
